package com.imooc.long5zb.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;

@Data   // 生成无参构造方法/getter/setter/hashCode/equals/toString
@Entity
@AllArgsConstructor // 生成所有参数构造方法
@NoArgsConstructor // @AllArgsConstructor会导致@Data不生成无参构造方法，需要手动添加@NoArgsConstructor，
// 如果没有无参构造方法，可能会导致比如com.fasterxml.jackson在序列化处理时报错
public class User implements Serializable {

    @Id
    @GeneratedValue()
    private Integer Id;

    @Column(nullable = false, unique = true)
    private String userName;

    @Column(nullable = false, unique = true)
    private String password;

    private String phone;

    private String email;

    @JsonFormat
    @Column(nullable = true, unique = false)
    private Date birthday;

    @JsonFormat
    @Column(nullable = true, unique = false)
    private Date createTime;

    @JsonFormat
    @Column(nullable = true, unique = false)
    private Date updateTime;


}
